// 放置全局指令

import store from '@/store'
const directivePlugin = (Vue) => {
  Vue.directive('checkBtn', {
    inserted(el, binding) {
      // 1.权限数据 -> points 2. binding.value -> 按钮自身的标识
      const points = store.state.user.userInfo.roles.points
      if (!points.includes(binding.value)) {
        // 把当前的按钮移除
        // 移除el dom 1.removeToken() 2.先找到父节点 removeChild
        el.remove()
      }
    }
  })
}
export default directivePlugin
